<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>节点的属性</title>
</head>
<body>

   <div class="box1">1</div>
   <div class="box2">2</div>
   <div class="box3">3</div>
   <div class="box4">4</div>
   <div class="box5">5</div>

   <script>
    var divEls = document.querySelectorAll("div");
    //使用innerHTML获取以及修改
    var counter = 1;
    for(el of divEls)
    {
        console.log(el.innerHTML);
        el.innerHTML = `<h1>${counter}</h1>`
        counter++;
    }
    //修改
    
   </script>
    
</body>
</html>